iMouse投屏 下载图片
调用说明
依赖 iMouse投屏 客户端
只在这台设备以 iMouse投屏 方式推流时可用,前置条件与 code 70~73 的含义见「iMouse投屏 相册列表」。
把手机上的图片按 id 下载到电脑。文件名用手机上的原始文件名,同名会覆盖。
- 请求参数
| 参数 | 类型 | 说明 | 备注 |
|---|---|---|---|
| fun | 字符串 | /plugin/imcast/photo/down | 请求功能名 |
| id | 字符串 | 设备id | 不允许多个 |
| ids | 字符串数组 | 图片 id 列表 | 来自「图片列表」的 list[].id |
| save_path | 字符串 | 保存目录 | 不传存到内核目录下 Download\<设备id>\(设备 id 里的冒号换成下划线) |
| outtime | 整数 | 每张的超时时间 | 单位毫秒,不传或 0 用内核配置(默认 15 秒) |
- httpGet请求示例
curl --request GET \
--url 'http://192.168.9.9:9911/api/plugin/imcast/photo/down?id=6C:8D:C1:67:04:29&ids=%5B%227181C209-321B-4BA6-9D4E-B3B88AE0AD92%2FL0%2F001%22%5D'
- httpPost请求示例
curl --request POST \
--url http://192.168.9.9:9911/api \
--header "content-type: multipart/form-data" \
--form "fun=/plugin/imcast/photo/down" \
--form "id=6C:8D:C1:67:04:29" \
--form 'ids=["7181C209-321B-4BA6-9D4E-B3B88AE0AD92/L0/001"]' \
--form "save_path=D:\\photos\\"
- httpPost json请求示例【websocket也可发送同样json请求】
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/plugin/imcast/photo/down",
"data": {
"id": "6C:8D:C1:67:04:29",
"ids": ["7181C209-321B-4BA6-9D4E-B3B88AE0AD92/L0/001", "C8C4C2E5-FF89-48E3-8454-33248239EAE5/L0/001"],
"save_path": "D:\\photos\\"
}
}'
响应结果
{
"data": {
"list": [
{
"id": "7181C209-321B-4BA6-9D4E-B3B88AE0AD92/L0/001",
"file": "D:\\photos\\imcast_blue.png",
"success": true,
"message": ""
},
{
"id": "bad-id",
"file": "",
"success": false,
"message": "iMouse投屏客户端返回错误(404):图片不存在"
}
],
"total": 2,
"success": 1,
"fail": 1,
"code": 0,
"id": "6C:8D:C1:67:04:29",
"message": "成功"
},
"status": 200,
"message": "成功",
"msgid": 0,
"fun": "/plugin/imcast/photo/down"
}
- 响应data数据字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| code | 整数 | 至少一张成功为 0;一张都没成功时是第一张的错误码 |
| total | 整数 | 请求的张数 |
| success / fail | 整数 | 成功 / 失败张数 |
| list[].id | 字符串 | 图片 id |
| list[].file | 字符串 | 保存到电脑上的完整路径(失败为空) |
| list[].success | 布尔值 | 这张是否成功 |
| list[].message | 字符串 | 失败原因 |